package controller;

import business.datacenter.HZCreditPermissionService;
import business.report.*;
import datacenter.domain.HZCreditPermission;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import report.domain.*;
import util.StringUtil;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by SunZZ on 2016/6/13.
 */
@Controller
public class ReportController {



    @Resource(name ="permissionService")
    private HZCreditPermissionService hzCreditPermissionService;


    @Resource(name = "acceptanceAgencyService")
    private AcceptanceAgencyService acceptanceAgencyService;

    @Resource(name = "agencyperService")
    private AgencyService agencyService;

    @Resource(name = "bulkLandService")
    private BulkLandService bulkLandService;

    @Resource(name = "cateringEnterprisesService")
    private CateringEnterprisesService cateringEnterprisesService;

    @Resource(name = "confiscatedWoodlandSrvice")
    private ConfiscatedWoodlandSrvice confiscatedWoodlandSrvice;

    @Resource(name = "constructionDesEnterprisesService")
    private ConstructionDesEnterprisesService constructionDesEnterprisesService;

    @Resource(name = "csEnterprisesService")
    private ConstructSupervisionEnterpriseService constructSupervisionEnterpriseService;

    @Resource(name = "constructionDrawingReviewService")
    private ConstructionDrawingReviewService constructionDrawingReviewService;

    @Resource(name = "cdEnterprisesService")
    private ConstructionEnterprisesService constructionEnterprisesService;

    @Resource(name = "creditServiceService")
    private CreditServiceService creditServiceService;

    @Resource(name = "drawingSurveyEnterpriseService")
    private DrawingSurveyEnterpriseService drawingSurveyEnterpriseService;

    @Resource(name = "drivingOperationService")
    private DrivingOperationService drivingOperationService;

    @Resource(name = "drugProductionService")
    private DrugProductionService drugProductionService;

    @Resource(name = "drugRetailService")
    private DrugRetailService drugRetailService;

    @Resource(name = "energyRatingAgenciesService")
    private EnergyRatingAgenciesService energyRatingAgenciesService;

    @Resource(name = "eProtectionAcceptanceService")
    private EnvironmentalProtectionAcceptanceService environmentalProtectionAcceptanceService;

    @Resource(name = "eProtectionService")
    private EnvironmentalProtectionService environmentalProtectionService;

    @Resource(name = "estateCompanyService")
    private EstateCompanyService estateCompanyService;

    @Resource(name = "foodProductionService")
    private FoodProductionService foodProductionService;

    @Resource(name = "foreignTradeService")
    private ForeignTradeService foreignTradeService;

    @Resource(name = "fsProductionService")
    private ForestrySeedProductionService forestrySeedProductionService;

    @Resource(name = "forestrySeedService")
    private ForestrySeedService forestrySeedService;

    @Resource(name = "healthCareService")
    private HealthCareService healthCareService;

    @Resource(name = "investmentAcceptanceService")
    private InvestmentAcceptanceService investmentAcceptanceService;

    @Resource(name = "investmentContractService")
    private InvestmentContractService investmentContractService;

    @Resource(name = "judicialExpertiseService")
    private JudicialExpertiseService judicialExpertiseService;

    @Resource(name = "landscapingService")
    private LandscapingService landscapingService;

    @Resource(name = "listedCompanyService")
    private ListedCompanyService listedCompanyService;

    @Resource(name = "miOperationService")
    private MedicalInstrumentsOperationService medicalInstrumentsOperationService;

    @Resource(name = "miProducctionService")
    private MedicalInstrumentsProducctionService medicalInstrumentsProducctionService;

    @Resource(name = "notaryOfficeService")
    private NotaryOfficeService notaryOfficeService;

    @Resource(name = "passengerTransportService")
    private PassengerTransportService passengerTransportService;

    @Resource(name = "policeEngraveService")
    private PoliceEngraveService policeEngraveService;

    @Resource(name = "policeHotelService")
    private PoliceHotelService policeHotelService;

    @Resource(name = "policeLawSService")
    private PoliceLawSService policeLawSService;

    @Resource(name = "policeSecurityService")
    private PoliceSecurityService policeSecurityService;

    @Resource(name = "pcService")
    private PriceConsultationService priceConsultationService;

    @Resource(name = "provinceFamousBrandService")
    private ProvinceFamousBrandService provinceFamousBrandService;

    @Resource(name = "repairOperationService")
    private RepairOperationService repairOperationService;

    @Resource(name = "securityTrainingService")
    private SecurityTrainingService securityTrainingService;

    @Resource(name = "softwareEnterpriseService")
    private SoftwareEnterpriseService softwareEnterpriseService;

    @Resource(name = "stationOperationService")
    private StationOperationService stationOperationService;

    @Resource(name = "supervisionEnterpriseService")
    private SupervisionEnterpriseService supervisionEnterpriseService;

    @Resource(name = "surveyDesignService")
    private SurveyDesignService surveyDesignService;

    @Resource(name = "taxiOperationService")
    private TaxiOperationService taxiOperationService;

    @Resource(name = "technologyPatentService")
    private TechnologyPatentService technologyPatentService;

    @Resource(name = "transportOperationService")
    private TransportOperationService transportOperationService;

    @Resource(name = "travelAgencyService")
    private TravelAgencyService travelAgencyService;

    @Resource(name = "waterPermitService")
    private WaterPermitService waterPermitService;

    @Resource(name = "wsConservationService")
    private WaterSoilConservationService waterSoilConservationService;

    @Resource(name = "wtPersonService")
    private WaterwayTransportPersonService waterwayTransportPersonService;

    @Resource(name = "wtService")
    private WaterwayTransportService waterwayTransportService;

    @RequestMapping(value = "permission.htm")
    String PoliceEngraveConver(){
        List<PoliceEngrave> origin = policeEngraveService.selectAllPoliceEngrave();
        List<HZCreditPermission> data = new ArrayList<>();
        for (PoliceEngrave policedata:origin) {
            HZCreditPermission info = new HZCreditPermission();
            info.setCompanyname(policedata.getF04());
            info.setPermissioninfo("公章刻制业特种行业许可证信息");
            info.setPermissiondet("市公安局");
            data.add(info);
        }
        for(PoliceHotel policeHotel:policeHotelService.selectAllPoliceHotel())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市公安局");
            info.setPermissiondate(StringUtil.strToDate(policeHotel.getF05(),"yyyyMMddHHmmss"));
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("旅馆特种行业许可证信息");
            info.setCompanyname(policeHotel.getF02());
            data.add(info);
        }
        for (PoliceSecurity policeSecurity:policeSecurityService.selectAllPoliceSecurity())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市公安消防局");
            info.setPermissiondate(policeSecurity.getF07());
//            info.setPermissionperiod();
            info.setPermissioncode(policeSecurity.getF02());
            info.setPermissioninfo("安全许可信息");
            info.setCompanyname(policeSecurity.getF04());
            data.add(info);
        }
        for (PoliceLawService policeLawService:policeLawSService.selectAllPoliceLawService())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市司法局");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(policeLawService.getF02());
            info.setPermissioninfo("基层法律服务所信息");
            info.setCompanyname(policeLawService.getF01());
            data.add(info);
        }
        for (StationOperation stationOperation:stationOperationService.getStationOperation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市交通运输局");
            info.setPermissiondate(stationOperation.getF07());
            info.setPermissionperiod(stationOperation.getF08());
            info.setPermissioncode(stationOperation.getF02());
            info.setPermissioninfo("场站经营许可信息");
            info.setCompanyname(stationOperation.getF01());
            data.add(info);
        }
        for (TaxiOperation taxiOperation:taxiOperationService.getTaxiOperation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市交通运输局");
            info.setPermissiondate(taxiOperation.getF07());
            info.setPermissionperiod(taxiOperation.getF08());
            info.setPermissioncode(taxiOperation.getF02());
            info.setPermissioninfo("出租车经营许可信息");
            info.setCompanyname(taxiOperation.getF01());
            data.add(info);
        }
        for (TransportOperation transportOperation:transportOperationService.getTransportOperation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市交通运输局");
            info.setPermissiondate(transportOperation.getF07());
            info.setPermissionperiod(transportOperation.getF08());
            info.setPermissioncode(transportOperation.getF02());
            info.setPermissioninfo("货运经营许可信息");
            info.setCompanyname(transportOperation.getF01());
            data.add(info);
        }
        for (DrivingOperation drivingOperation:drivingOperationService.getDrivingOperation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市交通运输局");
//            info.setPermissiondate(drivingOperation.getF07());
//            info.setPermissionperiod(drivingOperation.getF08());
            info.setPermissioncode(drivingOperation.getF03());
            info.setPermissioninfo("驾培经营许可信息");
            info.setCompanyname(drivingOperation.getF01());
            data.add(info);
        }
        for (PassengerTransport passengerTransport:passengerTransportService.getPassengerTransport())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市交通运输局");
            info.setPermissiondate(passengerTransport.getF07());
            info.setPermissionperiod(passengerTransport.getF08());
            info.setPermissioncode(passengerTransport.getF04());
            info.setPermissioninfo("客运经营许可信息");
            info.setCompanyname(passengerTransport.getF01());
            data.add(info);
        }
        for (WaterwayTransportPerson waterwayTransportPerson:waterwayTransportPersonService.getWaterwayTransportPerson())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet(waterwayTransportPerson.getF06());
            info.setPermissiondate(StringUtil.strToDate(waterwayTransportPerson.getF07(),"weeks"));
            info.setPermissionperiod(StringUtil.strToDate(waterwayTransportPerson.getF08(),"weeks"));
//            info.setPermissioncode();
            info.setPermissioninfo("水路运输经营许可（个体经营者）信息");
            info.setCompanyname(waterwayTransportPerson.getF01());
            data.add(info);
        }
        for (WaterwayTransport waterwayTransport:waterwayTransportService.getWaterwayTransport())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet(waterwayTransport.getF06());
            info.setPermissiondate(StringUtil.strToDate(waterwayTransport.getF07(),"weeks"));
            info.setPermissionperiod(StringUtil.strToDate(waterwayTransport.getF08(),"weeks"));
//            info.setPermissioncode();
            info.setPermissioninfo("水路运输经营许可（国内水路运输企业）信息");
            info.setCompanyname(waterwayTransport.getF01());
            data.add(info);
        }
        for (RepairOperation repairOperation:repairOperationService.getRepairOperation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市交通运输局");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(repairOperation.getF04());
            info.setPermissioninfo("维修经营许可信息");
            info.setCompanyname(repairOperation.getF01());
            data.add(info);
        }
        for (WaterSoilConservation waterSoilConservation:waterSoilConservationService.getWaterSoilConservation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市林水局");
            info.setPermissiondate(waterSoilConservation.getF05());
//            info.setPermissionperiod();
            info.setPermissioncode(waterSoilConservation.getF04());
            info.setPermissioninfo("开发建设项目水土保持方案审批");
            info.setCompanyname(waterSoilConservation.getF02());
            data.add(info);
        }
        for (ForestrySeed forestrySeed:forestrySeedService.getForestrySeed())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市林水局");
            info.setPermissiondate(forestrySeed.getF05());
//            info.setPermissionperiod(forestrySeed.getF06());
            info.setPermissioncode(forestrySeed.getF04());
            info.setPermissioninfo("林业种子经营许可");
            info.setCompanyname(forestrySeed.getF02());
            data.add(info);
        }
        for (ForestrySeedProduction forestrySeedProduction:forestrySeedProductionService.getForestrySeedProduction())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市林水局");
            info.setPermissiondate(forestrySeedProduction.getF05());
//            info.setPermissionperiod(forestrySeedProduction.getF06());
            info.setPermissioncode(forestrySeedProduction.getF04());
            info.setPermissioninfo("林业种子生产许可");
            info.setCompanyname(forestrySeedProduction.getF02());
            data.add(info);
        }
        for (WaterPermit waterPermit:waterPermitService.getWaterPermit())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市林水局");
            info.setPermissiondate(waterPermit.getF05());
//            info.setPermissionperiod(waterPermit.getF06());
            info.setPermissioncode(waterPermit.getF04());
            info.setPermissioninfo("取水许可（水资源论证）");
            info.setCompanyname(waterPermit.getF02());
            data.add(info);
        }
        for (ConfiscatedWoodland confiscatedWoodland :confiscatedWoodlandSrvice.getConfiscatedWoodland())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市林水局");
            info.setPermissiondate(confiscatedWoodland.getF05());
//            info.setPermissionperiod(confiscatedWoodland.getF06());
            info.setPermissioncode(confiscatedWoodland.getF04());
            info.setPermissioninfo("征收、占用林地许可");
            info.setCompanyname(confiscatedWoodland.getF02());
            data.add(info);
        }
        for (CateringEnterprises cateringEnterprises:cateringEnterprisesService.getCateringEnterprises())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市市场监管局（食药监局）");
            info.setPermissiondate(cateringEnterprises.getF14());
            info.setPermissionperiod(cateringEnterprises.getF15());
            info.setPermissioncode(cateringEnterprises.getF16());
            info.setPermissioninfo("餐饮企业");
            info.setCompanyname(cateringEnterprises.getF05());
            data.add(info);
        }
        for (DrugRetail drugRetail:drugRetailService.getDrugRetail())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet(drugRetail.getF20());
//            info.setPermissiondate();
            info.setPermissionperiod(drugRetail.getF18());
            info.setPermissioncode(drugRetail.getF19());
            info.setPermissioninfo("药品零售企业");
            info.setCompanyname(drugRetail.getF05());
            data.add(info);
        }
        for (DrugProduction drugProduction:drugProductionService.getDrugProduction())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市市场监管局（食药监局）");
            info.setPermissiondate(drugProduction.getF02());
            info.setPermissionperiod(drugProduction.getF03());
            info.setPermissioncode(drugProduction.getF20());
            info.setPermissioninfo("药品生产企业");
            info.setCompanyname(drugProduction.getF12());
            data.add(info);
        }
        for (MedicalInstrumentsOperation medicalInstrumentsOperation:medicalInstrumentsOperationService.getMedicalInstrumentsOperation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市市场监管局（食药监局）");
            info.setPermissiondate(medicalInstrumentsOperation.getF27());
            info.setPermissionperiod(medicalInstrumentsOperation.getF28());
            info.setPermissioncode(medicalInstrumentsOperation.getF03());
            info.setPermissioninfo("医疗器械经营企业");
            info.setCompanyname(medicalInstrumentsOperation.getF02());
            data.add(info);
        }
        for (FoodProduction foodProduction:foodProductionService.getFoodProduction())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("省交换");
//            info.setPermissiondate();
            info.setPermissionperiod(foodProduction.getF05());
//            info.setPermissioncode();
            info.setPermissioninfo("省食品生产许可信息");
            info.setCompanyname(foodProduction.getF04());
            data.add(info);
        }
        for (MedicalInstrumentsProducction medicalInstrumentsProducction:medicalInstrumentsProducctionService.getMedicalInstrumentsProducction())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet(medicalInstrumentsProducction.getF11());
            info.setPermissiondate(medicalInstrumentsProducction.getF10());
            info.setPermissionperiod(medicalInstrumentsProducction.getF09());
            info.setPermissioncode(medicalInstrumentsProducction.getF02());
            info.setPermissioninfo("医疗器械生产企业");
            info.setCompanyname(medicalInstrumentsProducction.getF03());
            data.add(info);
        }
        for (TechnologyPatent technologyPatent:technologyPatentService.getTechnologyPatent())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市科委");
            info.setPermissiondate(StringUtil.strToDate(technologyPatent.getF05(),"toup"));
            info.setPermissionperiod(StringUtil.strToDate(technologyPatent.getF05(),"todown"));
//            info.setPermissioncode();
            info.setPermissioninfo("重大科技专项项目信息");
            info.setCompanyname(technologyPatent.getF01());
            data.add(info);
        }
        for (SupervisionEnterprise supervisionEnterprise:supervisionEnterpriseService.getSupervisionEnterprise())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市人防办");
            info.setPermissiondate(supervisionEnterprise.getF08());
            info.setPermissionperiod(supervisionEnterprise.getF09());
//            info.setPermissioncode();
            info.setPermissioninfo("人防监理企业基本信息");
            info.setCompanyname(supervisionEnterprise.getF02());
            data.add(info);
        }
        for (TravelAgency travelAgency:travelAgencyService.getTravelAgency())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市旅委");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(travelAgency.getF03());
            info.setPermissioninfo("旅行社基本信息");
            info.setCompanyname(travelAgency.getF02());
            data.add(info);
        }
        for (BulkLand bulkLand:bulkLandService.getBulkLand())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市国土资源局");
//            info.setPermissiondate();
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("国土大宗土地登记");
            info.setCompanyname(bulkLand.getF02());
            data.add(info);
        }
        for (EnvironmentalProtection environmentalProtection:environmentalProtectionService.getEnvironmentalProtection())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet(environmentalProtection.getF06());
            info.setPermissiondate(environmentalProtection.getF07());
//            info.setPermissionperiod();
            info.setPermissioncode(environmentalProtection.getF04());
            info.setPermissioninfo("环保审批情况\n");
            info.setCompanyname(environmentalProtection.getF02());
            data.add(info);
        }
        for (EnvironmentalProtectionAcceptance environmentalProtectionAcceptance:environmentalProtectionAcceptanceService.getEnvironmentalProtectionAcceptance())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市环保局");
            info.setPermissiondate(environmentalProtectionAcceptance.getF03());
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("环境保护竣工验收情况");
            info.setCompanyname(environmentalProtectionAcceptance.getF01());
            data.add(info);
        }
        for (InvestmentAcceptance investmentAcceptance:investmentAcceptanceService.getInvestmentAcceptance())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市发改委");
//            info.setPermissiondate();
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("投资项目审批、核准、备案、审核转报结果信息");
            info.setCompanyname(investmentAcceptance.getF02());
            data.add(info);
        }
        for (SecurityTraining securityTraining:securityTrainingService.getSecurityTraining())
        {
            HZCreditPermission info = new HZCreditPermission();
//            info.setPermissiondet();
//            info.setPermissiondate();
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("保安培训学校");
            info.setCompanyname(securityTraining.getF02());
            data.add(info);
        }
        for (InvestmentContract investmentContract:investmentContractService.getInvestmentContract())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市审管办");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(investmentContract.getF02());
            info.setPermissioninfo("投资项目预选承包商");
            info.setCompanyname(investmentContract.getF01());
            data.add(info);
        }
        for (AcceptanceAgency acceptanceAgency:acceptanceAgencyService.getAcceptanceAgency())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet(acceptanceAgency.getF06());
//            info.setPermissiondate();
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("审批中介机构名单");
            info.setCompanyname(acceptanceAgency.getF02());
            data.add(info);
        }
        for (JudicialExpertise judicialExpertise:judicialExpertiseService.getJudicialExpertise())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市司法局");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(judicialExpertise.getF03());
            info.setPermissioninfo("司法鉴定机构信息");
            info.setCompanyname(judicialExpertise.getF01());
            data.add(info);
        }
        for (HealthCare healthCare:healthCareService.getHealthCare())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市卫计委");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(healthCare.getF05());
            info.setPermissioninfo("医疗卫生机构信息");
            info.setCompanyname(healthCare.getF01());
            data.add(info);
        }
        for (ForeignTrade foreignTrade:foreignTradeService.getForeignTrade())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市商务委");
            info.setPermissiondate(StringUtil.yearAdd(foreignTrade.getF04(),"0"));
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("对外贸易经营者登记信息");
            info.setCompanyname(foreignTrade.getF01());
            data.add(info);
        }
        for (ProvinceFamousBrand provinceFamousBrand:provinceFamousBrandService.getProvinceFamousBrand())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市质监局");
            info.setPermissiondate(StringUtil.strToDate(provinceFamousBrand.getF06(),"yyyyF"));
            info.setPermissionperiod(StringUtil.yearAdd(provinceFamousBrand.getF06(),provinceFamousBrand.getF05()));
            info.setPermissioncode(provinceFamousBrand.getF03());
            info.setPermissioninfo("省名牌信息");
            info.setCompanyname(provinceFamousBrand.getF02());
            data.add(info);
        }
        for (CreditService creditService:creditServiceService.getCreditService())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("省交换");
//            info.setPermissiondate();
//            info.setPermissionperiod();
//            info.setPermissioncode();
            info.setPermissioninfo("省信用服务机构备案信息");
            info.setCompanyname(creditService.getF04());
            data.add(info);
        }
        for (ListedCompany listedCompany:listedCompanyService.getListedCompany())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("省交换");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(listedCompany.getF04());
            info.setPermissioninfo("省上市公司信息");
            info.setCompanyname(listedCompany.getF05());
            data.add(info);
        }
        for (NotaryOffice notaryOffice :notaryOfficeService.getNotaryOffice())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("省交换");
//            info.setPermissiondate(notaryOffic);
//            info.setPermissionperiod();
            info.setPermissioncode(notaryOffice.getF04());
            info.setPermissioninfo("省公证机构基本信息");
            info.setCompanyname(notaryOffice.getF03());
            data.add(info);
        }
        for (ConstructionEnterprises constructionEnterprises:constructionEnterprisesService.getConstructionEnterprises())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(constructionEnterprises.getF11());
            info.setPermissionperiod(constructionEnterprises.getF12());
            info.setPermissioncode(constructionEnterprises.getF10());
            info.setPermissioninfo("施工企业信息");
            info.setCompanyname(constructionEnterprises.getF02());
            data.add(info);
        }
        for (ConstructionDesEnterprises constructionDesEnterprises:constructionDesEnterprisesService.getConstructionDesEnterprises())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(constructionDesEnterprises.getF10());
            info.setPermissionperiod(constructionDesEnterprises.getF11());
            info.setPermissioncode(constructionDesEnterprises.getF09());
            info.setPermissioninfo("设计与施工一体化企业信息");
            info.setCompanyname(constructionDesEnterprises.getF01());
            data.add(info);
        }
        for (Agency agency:agencyService.getAgency())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(agency.getF10());
            info.setPermissionperiod(agency.getF11());
            info.setPermissioncode(agency.getF09());
            info.setPermissioninfo("代理机构信息");
            info.setCompanyname(agency.getF01());
            data.add(info);
        }
        for (Landscaping landscaping:landscapingService.getLandscaping())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(landscaping.getF10());
            info.setPermissionperiod(landscaping.getF11());
            info.setPermissioncode(landscaping.getF09());
            info.setPermissioninfo("园林绿化企业信息");
            info.setCompanyname(landscaping.getF01());
            data.add(info);
        }
        for (ConstructSupervisionEnterprise constructSupervisionEnterprise:constructSupervisionEnterpriseService.getConstructSupervisionEnterprise())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(constructSupervisionEnterprise.getF10());
            info.setPermissionperiod(constructSupervisionEnterprise.getF11());
            info.setPermissioncode(constructSupervisionEnterprise.getF09());
            info.setPermissioninfo("监理企业信息");
            info.setCompanyname(constructSupervisionEnterprise.getF01());
            data.add(info);
        }
        for (PriceConsultation priceConsultation :priceConsultationService.getPriceConsultation())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(priceConsultation.getF10());
            info.setPermissionperiod(priceConsultation.getF11());
            info.setPermissioncode(priceConsultation.getF09());
            info.setPermissioninfo("造价咨询企业信息");
            info.setCompanyname(priceConsultation.getF01());
            data.add(info);
        }
        for (SurveyDesign surveyDesign:surveyDesignService.getSurveyDesign())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(surveyDesign.getF13());
            info.setPermissioninfo("勘察设计企业信息");
            info.setCompanyname(surveyDesign.getF02());
            data.add(info);
        }
        for (EstateCompany estateCompany:estateCompanyService.getEstateCompany())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(estateCompany.getF05());
            info.setPermissionperiod(estateCompany.getF06());
            info.setPermissioncode(estateCompany.getF08());
            info.setPermissioninfo("房地产企业信息");
            info.setCompanyname(estateCompany.getF01());
            data.add(info);
        }
        for (EnergyRatingAgencies energyRatingAgencies:energyRatingAgenciesService.getEnergyRatingAgencies())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市建委");
            info.setPermissiondate(energyRatingAgencies.getF10());
            info.setPermissionperiod(energyRatingAgencies.getF11());
            info.setPermissioncode(energyRatingAgencies.getF09());
            info.setPermissioninfo("能评机构");
            info.setCompanyname(energyRatingAgencies.getF01());
            data.add(info);
        }
        for (ConstructionDrawingReview constructionDrawingReview:constructionDrawingReviewService.getConstructionDrawingReview())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市人防办");
//            info.setPermissiondate(StringUtil.strToDate(constructionDrawingReview.getF07(),"yyyy.MM"));
//            info.setPermissionperiod(StringUtil.strToDate(constructionDrawingReview.getF08(),"yyyy.MM"));
            info.setPermissiondate(StringUtil.strToDateTrans(constructionDrawingReview.getF07()));
            info.setPermissionperiod(StringUtil.strToDateTrans(constructionDrawingReview.getF08()));
            info.setPermissioncode(constructionDrawingReview.getF13());
            info.setPermissioninfo("施工图审查中介机构信息收集表");
            info.setCompanyname(constructionDrawingReview.getF02());
            data.add(info);
        }
        for (DrawingSurveyEnterprise drawingSurveyEnterprise:drawingSurveyEnterpriseService.getDrawingSurveyEnterprise())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("市规划局");
//            info.setPermissiondate();
            info.setPermissionperiod(drawingSurveyEnterprise.getF06());
            info.setPermissioncode(drawingSurveyEnterprise.getF05());
            info.setPermissioninfo("测绘企业资质信息表");
            info.setCompanyname(drawingSurveyEnterprise.getF02());
            data.add(info);
        }
        for (SoftwareEnterprise softwareEnterprise:softwareEnterpriseService.getSoftwareEnterprise())
        {
            HZCreditPermission info = new HZCreditPermission();
            info.setPermissiondet("省交换");
//            info.setPermissiondate();
//            info.setPermissionperiod();
            info.setPermissioncode(softwareEnterprise.getF11());
            info.setPermissioninfo("省软件企业资质信息");
            info.setCompanyname(softwareEnterprise.getF05());
            data.add(info);
        }

        hzCreditPermissionService.savehzCreditPermissionService(data);
        System.out.print("permission");
        return "test";
    }

}
